home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / internet / amitcp3.0b / src.lha / src / amitcp / api / resolv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  3.5 KB  |  97 lines

  1. /*
  2.  * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that: (1) source distributions retain this entire copyright
  7.  * notice and comment, and (2) distributions including binaries display
  8.  * the following acknowledgement:  ``This product includes software
  9.  * developed by the University of California, Berkeley and its contributors''
  10.  * in the documentation or other materials provided with the distribution
  11.  * and in all advertising materials mentioning features or use of this
  12.  * software. Neither the name of the University nor the names of its
  13.  * contributors may be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  *
  19.  *    @(#)resolv.h    5.10 (Berkeley) 6/1/90
  20.  */
  21.  
  22. #ifndef API_RESOLV_H
  23. #define API_RESOLV_H
  24.  
  25. /*
  26.  * Global defines and variables for resolver stub. (INSIDE AmiTCP/IP)
  27.  */
  28. #define    MAXDFLSRCH    3        /* # default domain levels to try */
  29. #define    LOCALDOMAINPARTS 2        /* min levels in name that is "local"*/
  30.  
  31. #define    RES_TIMEOUT    5        /* min. seconds between retries */
  32.  
  33. struct state {
  34.     int    retrans;         /* retransmition time interval */
  35.     int    retry;            /* number of times to retransmit */
  36.     long    options;        /* option flags - see below. */
  37.     u_short    id;            /* current packet id */
  38. };
  39.  
  40. /*
  41.  * defines to hook variables to the library base.
  42.  */
  43. #define h_errno (*libPtr->hErrnoPtr)
  44. #define _res (libPtr->res_state)
  45. #define res_sock (libPtr->res_socket)
  46.  
  47. /*
  48.  * Resolver options
  49.  */
  50. #define RES_INIT    0x0001        /* address initialized */
  51. #ifndef AMITCP /* IMPORTANT TO HAVE RES_DEBUG NOT DEFINED IF NOT DEBUGGING */
  52. #define RES_DEBUG    0x0002        /* print debug messages */
  53. #endif
  54. #define RES_AAONLY    0x0004        /* authoritative answers only */
  55. #define RES_USEVC    0x0008        /* use virtual circuit */
  56. #define RES_PRIMARY    0x0010        /* query primary server only */
  57. #define RES_IGNTC    0x0020        /* ignore trucation errors */
  58. #define RES_RECURSE    0x0040        /* recursion desired */
  59. #define RES_DEFNAMES    0x0080        /* use default domain name */
  60. #define RES_STAYOPEN    0x0100        /* Keep TCP socket open */
  61. #define RES_DNSRCH    0x0200        /* search up local domain tree */
  62.  
  63. #define RES_DEFAULT    (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
  64.  
  65. #ifndef AMITCP /* AmiTCP has this in the SocketBase */ 
  66. extern struct state _res;
  67. #endif
  68.  
  69. /*
  70.  * Prototypes
  71.  */
  72. extern void res_init(struct state *state);
  73. extern int res_query(struct SocketBase *,
  74.              const char *, int, int, u_char *, int);
  75. extern int res_search(struct SocketBase *,
  76.               const char *, int, int, u_char *, int);
  77. extern int dn_expand(const u_char *, const u_char *, const u_char *, u_char *,
  78.              int);
  79. extern int dn_comp(const u_char *, u_char *, int, u_char **, u_char **);
  80. extern int __dn_skipname(const u_char *, const u_char *);
  81.  
  82. /* struct rrec; */
  83. extern int res_mkquery(struct SocketBase *,
  84.                int, const char *, int, int, const char *,
  85.                int, const struct rrec *, char *, int);
  86. extern int res_querydomain(struct SocketBase *, const char *, const char *,
  87.                int, int, u_char *, int);
  88. extern int res_send(struct SocketBase *, const char *, int, char *, int);
  89. extern void _res_close(struct SocketBase *);
  90.  
  91. extern u_short _getshort(u_char *);
  92. extern u_long _getlong(u_char *);
  93. extern void __putshort(u_short, u_char *);
  94. extern void __putlong(u_long, u_char *);
  95.  
  96. #endif /* API_RESOLV_H */
  97.